The invention relates generally to computer system support of application program execution and, more particularly but not by way of limitation, to a method and apparatus for redirecting command line utility output to a non-application maintained storage location.
Many applications such as word processing and file viewing programs have occasion to access system information. Often, such system information is available only through command line (e.g., console) utilities. That is, utilities that are accessible only through a command line interface. Illustrative command line utilities include “dir” and “net view” commands available in the Microsoft WINDOWS® operating system and the “w” command available in UNIX® and UNIX®-like operating systems (provides a list of users logged onto a specified is computer system).
One difficulty with command line utilities is that their output is not generally directly useable by an executing application. The conventional technique by which a user application obtains command line utility output is shown in FIG. 1. After a temporary text file is created (block 100), the command line utility whose output is desired is invoked via a standard interface (block 102). Output from the command line utility is piped to the temporary file (block 104), from which the application extracts and processes the desired data (block 106). Sound programming practice calls for the destruction/removal of the temporary file created in block 100 (block 108). It will be recognized that a temporary file may be created by the piping operation itself, i.e., during the acts of block 104. Nevertheless, the use of a temporary file is generally considered essential.
A problem with the technique of FIG. 1 is that the application invoking the command line utility may not have file creation privileges on the computer system. If this is so, then the application will be unable to obtain the desired data. Another problem is that if the disk the application has access to is full (i.e., incapable of accepting new or enlarged user files), any attempt to create a new file will generate an error. Yet another problem is that the file name chosen for the temporary file may already be in use. Still another problem is that many new PCs are disk-less and, thus, may not provide a mechanism through which user initiated (i.e., user invoked application) file input-output is possible. A further problem with prior art techniques such as that shown in FIG. 1 is that maintenance of temporary files is left to the calling application. If the application that creates a temporary file fails to remove it, a plethora of useless files may be generated over time.
Thus, it would be beneficial to provide a mechanism by which an application program may obtain output from a command line utility without the need to create a temporary file.